package com.example.chapter03;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.chapter03.utils.Utils;

public class ViewBorderActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_view_border);

        TextView text_view = findViewById(R.id.text_view_border);
        // 获取布局参数
        ViewGroup.LayoutParams layout_params = text_view.getLayoutParams();
        // 修改布局参数中的宽度，默认px单位，需要把dp转换为px
        layout_params.width = Utils.dip2px(this, 300);
        text_view.setLayoutParams(layout_params);

     }
}